/*
* @Author: wanghongfucoder
* @Date:   2017-03-16 10:25:45
* @Last Modified by:   wanghongfucoder
* @Last Modified time: 2017-03-16 10:34:03
*/

public class Demo {
	
	public static void main(String[] args) {
	  Originator Originator = new Originator();
      CareTaker careTaker = new CareTaker();
      Originator.setState("State #1");
      Originator.setState("State #2");
      careTaker.add(Originator.saveStateToMemento());
      Originator.setState("State #3");
      careTaker.add(Originator.saveStateToMemento());
      Originator.setState("State #4");

      System.out.println("Current State: " + Originator.getState());		
      Originator.getStateFromMemento(careTaker.get(0));
      System.out.println("First saved State: " + Originator.getState());
      Originator.getStateFromMemento(careTaker.get(1));
      System.out.println("Second saved State: " + Originator.getState());
	}
}